<?php

use console\services\MigrateService;
use yii\db\Migration;

/**
 * Handles the creation of table `sys_admin_dept`.
 */
class m231229_144101_create_sys_admin_dept_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_admin_dept', [
            'id' => $this->bigPrimaryKey(),
            'admin_id' => $this->bigInteger()->defaultValue(0)->notNull()->comment('用户ID'),
            'dept_id' => $this->bigInteger()->defaultValue(0)->notNull()->comment('部门ID'),
        ], MigrateService::createTableOptions('人员部门表'));
        $this->insert('sys_admin_dept', ['admin_id' => 10000, 'dept_id' => 100]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_admin_dept');
    }
}
